const fork = require('child_process').fork
const cpus = require('os').cpus();
console.log(`cpu number: ${cpus.length}`)
for (let i = 0; i < cpus.length; i++) {
	let n = fork('./server.js')
	n.on('message', m => {
		console.log(`parent got message from ${i} :${m}`);
	});
	n.send(`hello my slave ${i}`);
}